<?php

function list_data(){
	$header = array(
		'#'=>array('style'=>'text-align:center;border-bottom:2px solid;width:5%'),  
		'NIK'=>array('style'=>'border-bottom:2px solid;width:10%'), 
		'Nama Karyawan'=>array('style'=>'border-bottom:2px solid;width:60%'), 
		'Nominal'=>array('style'=>'border-bottom:2px solid;width:20%'), 
		' '=>array('style'=>'border-bottom:2px solid;width:5%'), 
	);
	$ktahun = isset($_GET['ktahun']) ? $_GET['ktahun'] : date('Y');
	$kid = isset($_GET['kid']) ? $_GET['kid'] : 0;
	$_GET['nik_start'] = isset($_GET['nik_start']) ? sprintf('%07d',(int)$_GET['nik_start']) :'0000001'; 	
	$_GET['nik_end'] = (isset($_GET['nik_end']) AND (int) $_GET['nik_end'] !='0' )? sprintf('%07d',(int)$_GET['nik_end']) :'9999999'; 	
	$nik_start = isset($_GET['nik_start']) ? $_GET['nik_start'] : $nik_start_default;
	$nik_end = isset($_GET['nik_end']) ? $_GET['nik_end'] : $nik_end_default;
	
	$pr_yearly_income_id=get_pr_yearly_income_id($kid,$ktahun) ;
	
	$query = "SELECT max(komponen_id) as komponen_id FROM pr_yearly_income_komponen WHERE pr_yearly_income_id={$pr_yearly_income_id} ";
	$result = my_query($query );
	$ey = my_fetch_array($result) ;
	$komponen_id=isset($ey['komponen_id']) ? $ey['komponen_id'] : 0 ;

	$query = "
		SELECT a.karyawan_id,a.nominal FROM pr_yearly_income_karyawan a
		INNER JOIN karyawan c ON a.karyawan_id=c.karyawan_id 
		WHERE a.komponen_id={$komponen_id} 
		AND a.pr_yearly_income_id={$pr_yearly_income_id} 
		AND	(c.nik BETWEEN {$nik_start}	AND {$nik_end}) 
		ORDER BY c.nik
	";	
	 
	$result = my_query($query );
	$total_records = my_num_rows($result );
	$scroll_page =5;  
	$per_page =35;  
	$current_page = isset($_GET['page']) ? (int) $_GET['page'] : 1 ; 
	if($current_page < 1){
		$current_page = 1;
	}		 
	$pager_url  ="index.php?com={$_GET['com']}&kid={$_GET['kid']}&ktahun={$_GET['ktahun']}&nik_start={$nik_start}&nik_end={$nik_end}&page=";	 
	$inactive_page_tag = 'style="padding:4px;background-color:#BBBBBB"';  
	$previous_page_text = ' Mundur '; 
	$next_page_text = ' Maju ';  
	$first_page_text = ' Awal '; 
	$last_page_text = ' Akhir ';
	
	$kgPagerOBJ = new kgPager();
	$kgPagerOBJ->pager_set(
		$pager_url, 
		$total_records, 
		$scroll_page, 
		$per_page, 
		$current_page, 
		$inactive_page_tag, 
		$previous_page_text, 
		$next_page_text, 
		$first_page_text, 
		$last_page_text ,$pager_url_last); 
	 		
	$result = my_query($query ." LIMIT ".$kgPagerOBJ->start.", ".$kgPagerOBJ->per_page); 	
	$row = array(); 
	$i = ($current_page  - 1 ) * 35; 
	while($ey = my_fetch_array($result)){
		$i++; 
		$karyawans =  loaddata_karyawan($ey['karyawan_id']);  
		$cetakproperty = array(
				'href'=>'javascript:;',
				'onclick'=>'javascript:window.open(\'index.php?com='.$_GET['com'].
					'&task=plaincetak&pr_yearly_income_id='.$pr_yearly_income_id.
					'&karyawan_id='.$ey['karyawan_id'].'\',\'mywin\',\'left=20,top=20,width=800,height=600,toolbar=0,resizable=0\');',
				'title'=>'Cetak'
		);
		$cetak_button = button_icon( 'printer.gif' , $cetakproperty  );
		$row[] = array(
			'#'=>position_text_align ($i, 'center'), 
			'nik'=>  $karyawans['nik'] ,   
			'nama'=>  $karyawans['nama_gelar'],   
			'nominal'=> position_text_align(  'Rp. '.rp_format($ey['nominal'] ) , 'right'),  			
			'operasi'=> position_text_align(  $cetak_button , 'right'),  
		);		 
	}
	
	$datas = table_rows($row); 
	$paging = $kgPagerOBJ ->showPaging();	
	return form_view().table_builder($header , $datas ,  35, false,$paging  );
}

function form_view(){
	$view = form_header( "..." , "..."  ); 
	$view .= '<input type="hidden"  value="'.$_GET['com'].'" name="com" />';	
	$kid = isset($_GET['kid']) ? $_GET['kid'] : 0;
	$ktahun = isset($_GET['ktahun']) ? $_GET['ktahun'] : date('Y');

	$query = " SELECT * FROM yearly_income ORDER BY yearly_income_id ASC";
	$result = my_query($query);
	$ops = array();
	while($pop = my_fetch_array($result)){
		$ops[$pop['yearly_income_id']] = $pop['label'];
	}
	$temp = array(
		'id'=>'kid',
		'value'=>$kid ,
		'name'=>'kid',
	);
	$view .= form_field_display( form_dropdown($temp,$ops)   , "Yearly Income"   );
	
	$query = " SELECT * FROM pr_yearly_income GROUP BY tahun ORDER BY tahun DESC";
	$result = my_query($query);
	$ops = array();
	while($pop = my_fetch_array($result)){
		$ops[$pop['tahun']] = $pop['tahun'];
	}
	$temp = array(
		'id'=>'ktahun',
		'value'=>$ktahun ,
		'name'=>'ktahun',
	);
	$view .= form_field_display( form_dropdown($temp,$ops)   , "Tahun"   );

	$_GET['nik_start'] = isset($_GET['nik_start']) ? sprintf('%07d',(int)$_GET['nik_start']) :'0000001'; 	
	$_GET['nik_end'] = (isset($_GET['nik_end']) AND (int) $_GET['nik_end'] !='0' )? sprintf('%07d',(int)$_GET['nik_end']) :'9999999'; 	
 
	$nik_start = isset($_GET['nik_start']) ? $_GET['nik_start'] : $nik_start_default;
	$nik_end = isset($_GET['nik_end']) ? $_GET['nik_end'] : $nik_end_default;
	$form_start = '<input type="text" size="7" value="'.$nik_start.'" name="nik_start" />';
	$form_end = '<input type="text" size="7" value="'.$nik_end.'" name="nik_end" />';
	$view .= form_field_display( $form_start.' s/d '.$form_end  , "NIK Range"   );
	$submit = array(
		'value' => (  ' Check '  ),
		'name' => 'simpan', 
		'type'=>'submit','class'=>'main_button'
	);
	$form_submit= form_dynamic($submit); 	 
	$pr_yearly_income_id=get_pr_yearly_income_id($kid,$ktahun) ;
	$cetak = array(
		'value' => (  ' Cetak '  ),
		'onclick'=>'javascript:location.href=\'index.php?com='.$_GET['com'].
			'&task=cetak_all&pr_yearly_income_id='.$pr_yearly_income_id.
			'&nik_start='.$nik_start.'&nik_end='.$nik_end.'\'' ,
		'type'=>'button','class'=>'main_button'
	);
	$form_cetak= form_dynamic($cetak); 	 
	$view .= form_field_display( $form_submit .' '.$form_cetak   , "&nbsp;" ,  "" );
	$view .= form_footer( );
	$view = str_replace("method=\"post\"","method=\"get\"",$view);
	return $view;
}

function get_pr_yearly_income_id($kid,$ktahun){
	$query = "SELECT pr_yearly_income_id FROM pr_yearly_income WHERE yearly_income_id={$kid} AND tahun={$ktahun} LIMIT 1";	
	$result = my_query($query );
	$ey = my_fetch_array($result) ;
	$pr_yearly_income_id=isset($ey['pr_yearly_income_id']) ? $ey['pr_yearly_income_id'] : 0 ;
	return $pr_yearly_income_id ;
}	

function print_all(){
	$pr_yearly_income_id = isset( $_GET['pr_yearly_income_id'] ) ? $_GET['pr_yearly_income_id'] :  0;
	$pr_yearly_incomes = my_get_data_by_id('pr_yearly_income','pr_yearly_income_id',$pr_yearly_income_id);
	$yearly_income_id = isset( $pr_yearly_incomes['yearly_income_id'] ) ? $pr_yearly_incomes['yearly_income_id']  :  0;
	$yearly_incomes = my_get_data_by_id('yearly_income','yearly_income_id',$yearly_income_id);
	$periode_id = isset( $pr_yearly_incomes['periode_id'] ) ? $pr_yearly_incomes['periode_id']  :  0;

	$_GET['nik_start'] = isset($_GET['nik_start']) ? sprintf('%07d',(int)$_GET['nik_start']) :'0000001'; 	
	$_GET['nik_end'] = (isset($_GET['nik_end']) AND (int) $_GET['nik_end'] !='0' )? sprintf('%07d',(int)$_GET['nik_end']) :'9999999'; 	
	$nik_start = isset($_GET['nik_start']) ? $_GET['nik_start'] : $nik_start_default;
	$nik_end = isset($_GET['nik_end']) ? $_GET['nik_end'] : $nik_end_default;
	
	$query = "
		SELECT a.karyawan_id FROM pr_yearly_income_karyawan a
		INNER JOIN karyawan c ON a.karyawan_id=c.karyawan_id 
		WHERE a.pr_yearly_income_id={$pr_yearly_income_id} 
		AND	(c.nik BETWEEN {$nik_start}	AND {$nik_end}) 
		AND a.karyawan_id NOT IN (select karyawan_id FROM karyawan_disable)
		AND a.karyawan_id NOT IN (select karyawan_id FROM pemberhentian  ) 
		GROUP BY a.karyawan_id  
		ORDER BY c.nik  
	";	
	$result = my_query($query ); 
	$datas = array();  
	while($ey = my_fetch_array($result)){
		$karyawan_id = isset( $ey['karyawan_id'] ) ? $ey['karyawan_id'] :  0;
		$karyawan=loaddata_karyawan( $karyawan_id );
		$jabatan_id = isset( $karyawan['jabatan_id'] ) ? $karyawan['jabatan_id'] :  0;
		$jabatan=loaddata_jabatan( $jabatan_id );
		$gaji=get_gaji($karyawan_id , $periode_id) ;
		
		$judul='SLIP '.$yearly_incomes['label'];
		$periodedata = 'Tahun '.$pr_yearly_incomes['tahun'] ;
		$datas[] = array(
			 'k1'=>array(' ',15,STR_PAD_RIGHT),
			 'k2'=>array('P.T.  K R A K A T A U  M E D I K A',70,STR_PAD_BOTH),
			 'k3'=>array(' ',15,STR_PAD_RIGHT),
		); 
		$datas[] = array(
			 'k1'=>array(' ',15,STR_PAD_RIGHT),
			 'k2'=>array($judul,70,STR_PAD_BOTH),
		); 
		$datas[] = array(
			 'k1'=>array(' ',15,STR_PAD_RIGHT),
			 'k2'=>array($periodedata,70,STR_PAD_BOTH),
		); 
		$datas[] = array(
			 'k1'=>array(' ',100,STR_PAD_RIGHT),
		); 
		$datas[] = array(
			 'k1'=>array(' ',15,STR_PAD_RIGHT),
			 'k2'=>array('NIK',9,STR_PAD_RIGHT),
			 'k3'=>array(':',2,STR_PAD_RIGHT),
			 'k4'=>array(sprintf('%07d',$karyawan['nik']),28,STR_PAD_RIGHT),
			 'k5'=>array('T.M.B.',8,STR_PAD_RIGHT),
			 'k6'=>array(':',2,STR_PAD_RIGHT),
			 'k7'=>array(date('d-m-Y',strtotime($karyawan['tmb'])),21,STR_PAD_RIGHT),
		 ); 
		$datas[] = array(
			 'k1'=>array(' ',15,STR_PAD_RIGHT),
			 'k2'=>array('Dept/CCC',9,STR_PAD_RIGHT),
			 'k3'=>array(':',2,STR_PAD_RIGHT),
			 'k4'=>array($jabatan['nomor_posisi'].'/'.$jabatan['pos_biaya'],28,STR_PAD_RIGHT),
			 'k5'=>array('St.Kary',8,STR_PAD_RIGHT),
			 'k6'=>array(':',2,STR_PAD_RIGHT),
			 'k7'=>array(str_replace( "Karyawan ","",$karyawan['status_karyawan']),21,STR_PAD_RIGHT),
		 ); 
		$datas[] = array(
			 'k1'=>array(' ',15,STR_PAD_RIGHT),
			 'k2'=>array('Nama',9,STR_PAD_RIGHT),
			 'k3'=>array(':',2,STR_PAD_RIGHT),
			 'k4'=>array($karyawan['nama_gelar'],59,STR_PAD_RIGHT),
		 ); 
		$datas[] = array(
			 'k1'=>array(' ',15,STR_PAD_RIGHT),
			 'k2'=>array('Jabatan',9,STR_PAD_RIGHT),
			 'k3'=>array(':',2,STR_PAD_RIGHT),
			 'k4'=>array( (strlen($jabatan['nama_jabatan'])<51 ? $jabatan['nama_jabatan'] : substr($jabatan['nama_jabatan'],0,47).'...'),59,STR_PAD_RIGHT),
		 ); 
		$datas[] = array(
			 'k1'=>array(' ',100,STR_PAD_RIGHT),
		); 
		$datas[] = array(
			 'k1'=>array(' ',15,STR_PAD_RIGHT),
			 'k2'=>array(str_repeat("-", 70),70,STR_PAD_BOTH),
		 ); 
		$datas[] = array(
			 'k1'=>array(' ',15,STR_PAD_RIGHT),
			 'k2'=>array('Grade',6,STR_PAD_RIGHT),
			 'k3'=>array(':',2,STR_PAD_RIGHT),
			 'k4'=>array($karyawan['grade_id'],31,STR_PAD_RIGHT),
			 'k5'=>array('Golongan',8,STR_PAD_RIGHT),
			 'k6'=>array(':',2,STR_PAD_RIGHT),
			 'k7'=>array($karyawan['golongan_jabatan'],21,STR_PAD_RIGHT),
		 ); /*
		$datas[] = array(
			 'k1'=>array(' ',15,STR_PAD_RIGHT),
			 'k2'=>array('Gaji',40,STR_PAD_RIGHT),
			 'k3'=>array(': Rp.',5,STR_PAD_RIGHT),
			 'k4'=>array(rp_format($gaji),13,STR_PAD_LEFT),
		 ); */
		 
		$query = "
			SELECT * FROM pr_yearly_income_karyawan a
			INNER JOIN pr_yearly_income_komponen b ON a.komponen_id=b.komponen_id AND a.pr_yearly_income_id=b.pr_yearly_income_id 
			WHERE a.pr_yearly_income_id={$pr_yearly_income_id} 
			AND	a.karyawan_id={$karyawan_id} 
			ORDER BY a.komponen_id  ";	

		$res = my_query($query ); 	 
		while($ey1 = my_fetch_array($res)){
			if(  trim($ey1['code'])==''){
			}else{
					$datas[] = array(
						 'k1'=>array(' ',100,STR_PAD_RIGHT),
					);
			}
			if(  $ey1['tipe']=='Sub Total'){
				$datas[] = array(		 
					'k1'=>array(' ',15 ,STR_PAD_BOTH),
					'k2'=>array(' ' ,7 ,STR_PAD_LEFT),
					'k3'=>array(str_repeat("-", 53),70,STR_PAD_RIGHT),
				);		
			}	
			if(  $ey1['tipe']=='Header'){
				$nominal=' ' ;
				$separator=' ';
			}else{
				$nominal= $ey1['nominal']  ;
				$separator=': Rp.';
				if(  $ey1['kategori']=='-'){			
					$nominal*=-1 ;
				}
				$nominal=rp_format($nominal);			
			}	
			$datas[] = array(		 
				'k1'=>array(' ',15 ,STR_PAD_BOTH),
				'k2'=>array($ey1['code'] ,7 ,STR_PAD_LEFT),
				'k3'=>array($ey1['label'],32,STR_PAD_RIGHT),
				'k4'=>array($separator,5,STR_PAD_RIGHT),
				'k5'=>array($nominal,13,STR_PAD_LEFT), 
			);		
		}
		$datas[] = array(
			 'k1'=>array(' ',100,STR_PAD_RIGHT),
		);	
		$datas[] = array(
			 'k1'=>array(' ',100,STR_PAD_RIGHT),
		);	
		$datas[] = array(
			 'k1'=>array(' ',100,STR_PAD_RIGHT),
		);
		$datas[] = array(
 
			 'k1'=>array(  '         ',70 ,STR_PAD_BOTH),
		 ); 	  
		$datas[] = array(
 
			 'k1'=>array(  '                HRIS (c) 2011 - '.date('Y').' | PT RS Krakatau Medika',70 ,STR_PAD_BOTH),
		 ); 
			  
		
		$datas[] = array(
			 'k1'=>array(chr(12),1,STR_PAD_RIGHT),
		 ); 
	}
	$view = 	str_pad(" ",100," ",STR_PAD_BOTH);
	return $view ."\n"."\n".set_txt_report($datas);	
}

function print_plain($karyawan_id){
	$pr_yearly_income_id = isset( $_GET['pr_yearly_income_id'] ) ? $_GET['pr_yearly_income_id'] :  0;
	$pr_yearly_incomes = my_get_data_by_id('pr_yearly_income','pr_yearly_income_id',$pr_yearly_income_id);
	$yearly_income_id = isset( $pr_yearly_incomes['yearly_income_id'] ) ? $pr_yearly_incomes['yearly_income_id']  :  0;
	$yearly_incomes = my_get_data_by_id('yearly_income','yearly_income_id',$yearly_income_id);
	$periode_id = isset( $pr_yearly_incomes['periode_id'] ) ? $pr_yearly_incomes['periode_id']  :  0;
	
	$karyawan=loaddata_karyawan( $karyawan_id );
	$jabatan_id = isset( $karyawan['jabatan_id'] ) ? $karyawan['jabatan_id'] :  0;
	$jabatan=loaddata_jabatan( $jabatan_id );
	$gaji=get_gaji($karyawan_id , $periode_id) ;
	
	$judul='SLIP '.$yearly_incomes['label'];
	$periodedata = 'Tahun '.$pr_yearly_incomes['tahun'] ;
	$datas = array();  
	$datas[] = array(
		 'k1'=>array(' ',15,STR_PAD_RIGHT),
		 'k2'=>array('P.T.  K R A K A T A U  M E D I K A',70,STR_PAD_BOTH),
		 'k3'=>array(' ',15,STR_PAD_RIGHT),
	); 
	$datas[] = array(
		 'k1'=>array(' ',15,STR_PAD_RIGHT),
		 'k2'=>array($judul,70,STR_PAD_BOTH),
	); 
	$datas[] = array(
		 'k1'=>array(' ',15,STR_PAD_RIGHT),
		 'k2'=>array($periodedata,70,STR_PAD_BOTH),
	); 
	$datas[] = array(
		 'k1'=>array(' ',100,STR_PAD_RIGHT),
	); 
	$datas[] = array(
		 'k1'=>array(' ',15,STR_PAD_RIGHT),
		 'k2'=>array('NIK',9,STR_PAD_RIGHT),
		 'k3'=>array(':',2,STR_PAD_RIGHT),
		 'k4'=>array(sprintf('%07d',$karyawan['nik']),28,STR_PAD_RIGHT),
		 'k5'=>array('T.M.B.',8,STR_PAD_RIGHT),
		 'k6'=>array(':',2,STR_PAD_RIGHT),
		 'k7'=>array(date('d-m-Y',strtotime($karyawan['tmb'])),21,STR_PAD_RIGHT),
	 ); 
	$datas[] = array(
		 'k1'=>array(' ',15,STR_PAD_RIGHT),
		 'k2'=>array('Dept/CCC',9,STR_PAD_RIGHT),
		 'k3'=>array(':',2,STR_PAD_RIGHT),
		 'k4'=>array($jabatan['nomor_posisi'].'/'.$jabatan['pos_biaya'],28,STR_PAD_RIGHT),
		 'k5'=>array('St.Kary',8,STR_PAD_RIGHT),
		 'k6'=>array(':',2,STR_PAD_RIGHT),
		 'k7'=>array(str_replace( "Karyawan ","",$karyawan['status_karyawan']),21,STR_PAD_RIGHT),
	 ); 
	$datas[] = array(
		 'k1'=>array(' ',15,STR_PAD_RIGHT),
		 'k2'=>array('Nama',9,STR_PAD_RIGHT),
		 'k3'=>array(':',2,STR_PAD_RIGHT),
		 'k4'=>array($karyawan['nama_gelar'],59,STR_PAD_RIGHT),
	 ); 
	$datas[] = array(
		 'k1'=>array(' ',15,STR_PAD_RIGHT),
		 'k2'=>array('Jabatan',9,STR_PAD_RIGHT),
		 'k3'=>array(':',2,STR_PAD_RIGHT),
		 'k4'=>array( (strlen($jabatan['nama_jabatan'])<51 ? $jabatan['nama_jabatan'] : substr($jabatan['nama_jabatan'],0,47).'...'),59,STR_PAD_RIGHT),
	 ); 
	$datas[] = array(
		 'k1'=>array(' ',100,STR_PAD_RIGHT),
	); 
	$datas[] = array(
		 'k1'=>array(' ',15,STR_PAD_RIGHT),
		 'k2'=>array(str_repeat("-", 70),70,STR_PAD_BOTH),
	 ); 
	$datas[] = array(
		 'k1'=>array(' ',15,STR_PAD_RIGHT),
		 'k2'=>array('Grade',6,STR_PAD_RIGHT),
		 'k3'=>array(':',2,STR_PAD_RIGHT),
		 'k4'=>array($karyawan['grade_id'],31,STR_PAD_RIGHT),
		 'k5'=>array('Golongan',8,STR_PAD_RIGHT),
		 'k6'=>array(':',2,STR_PAD_RIGHT),
		 'k7'=>array($karyawan['golongan_jabatan'],21,STR_PAD_RIGHT),
	 ); 
	$datas[] = array(
		 'k1'=>array(' ',15,STR_PAD_RIGHT),
		 'k2'=>array('Gaji',40,STR_PAD_RIGHT),
		 'k3'=>array(': Rp.',5,STR_PAD_RIGHT),
		 'k4'=>array(rp_format($gaji),13,STR_PAD_LEFT),
	 ); 
	 
	$query = "
		SELECT * FROM pr_yearly_income_karyawan a
		INNER JOIN pr_yearly_income_komponen b ON a.komponen_id=b.komponen_id AND a.pr_yearly_income_id=b.pr_yearly_income_id 
		WHERE a.pr_yearly_income_id={$pr_yearly_income_id} 
		AND	a.karyawan_id={$karyawan_id} 
		ORDER BY a.komponen_id  ";	

	$result = my_query($query ); 	 
	while($ey = my_fetch_array($result)){
		if(  trim($ey['code'])==''){
		}else{
				$datas[] = array(
					 'k1'=>array(' ',100,STR_PAD_RIGHT),
				);
		}
		if(  $ey['tipe']=='Sub Total'){
			$datas[] = array(		 
				'k1'=>array(' ',15 ,STR_PAD_BOTH),
				'k2'=>array(' ' ,7 ,STR_PAD_LEFT),
				'k3'=>array(str_repeat("-", 53),70,STR_PAD_RIGHT),
			);		
		}	
		if(  $ey['tipe']=='Header'){
			$nominal=' ' ;
			$separator=' ';
		}else{
			$nominal= $ey['nominal']  ;
			$separator=': Rp.';
			if(  $ey['kategori']=='-'){			
				$nominal*=-1 ;
			}
			$nominal=rp_format($nominal);			
		}	
		$datas[] = array(		 
			'k1'=>array(' ',15 ,STR_PAD_BOTH),
			'k2'=>array($ey['code'] ,7 ,STR_PAD_LEFT),
			'k3'=>array($ey['label'],32,STR_PAD_RIGHT),
			'k4'=>array($separator,5,STR_PAD_RIGHT),
			'k5'=>array($nominal,13,STR_PAD_LEFT), 
		);		
	}
	$datas[] = array(
		 'k1'=>array(' ',100,STR_PAD_RIGHT),
	);	 
	$datas[] = array(
		 'k1'=>array(' ',15,STR_PAD_RIGHT),
		 'k2'=>array(str_repeat("-", 70),70,STR_PAD_BOTH),
	 ); 
	$datas[] = array(
		 'k1'=>array(chr(12),1,STR_PAD_RIGHT),
	 ); 
	$view = str_pad(" ",100," ",STR_PAD_BOTH);
	return $view ."\n"."\n".set_txt_report($datas);	
}

function get_gaji($karyawan_id , $periode_id){ 
	$query = " SELECT gapok_km FROM pr_gaji 
		WHERE periode_id={$periode_id}
		AND karyawan_id=".$karyawan_id
	;
	$result = my_query($query);	
	$datas = my_fetch_array($result);	
	return $datas['gapok_km'];
}
